import FrameView from "../views/main/frame.vue";
import AbsentView from "../views/absent/index.vue";
import MyAbsent from "../views/absent/my.vue";
import SubAbsent from "../views/absent/sub.vue";
import InformView from "../views/inform/index.vue";
import public_inform from "../views/inform/public.vue";
import detail from "../views/inform/detail.vue";
import list from "../views/inform/list.vue";
import StaffView from "../views/staff/index.vue";
import add from "../views/staff/add.vue";
import staff from "../views/staff/list.vue";
import home from "../views/home/home.vue";
import { PermissionChoices } from "@/stores/auth";

const routes = [
  {
    path: "/",
    name: "frame",
    component: FrameView,
    children: [
      // 首页
      {
        path: "/",
        name: "home",
        component: home,
        meta: {
          icon: "HomeFilled",
          text: "首页",
          permissions: [PermissionChoices.Staff],
          opt: "|",
        },
      },
      // 考勤管理模块
      {
        path: "/absent",
        name: "AbsentView",
        component: AbsentView,
        meta: {
          icon: "Checked",
          text: "考勤管理",
          permissions: [PermissionChoices.Staff],
          opt: "|",
        },
        children: [
          {
            path: "my",
            name: "MyAbsent",
            component: MyAbsent,
            meta: {
              icon: "Document",
              text: "个人考勤",
              permissions: [PermissionChoices.Staff],
              opt: "|",
            },
          },
          {
            path: "sub",
            name: "SubAbsent",
            component: SubAbsent,
            meta: {
              icon: "List",
              text: "下属考勤",
              permissions: [
                PermissionChoices.Boarder,
                PermissionChoices.Leader,
              ],
              opt: "|",
            },
          },
        ],
      },
      //通知管理模块
      {
        path: "/inform",
        name: "InformView",
        component: InformView,
        meta: {
          icon: "BellFilled",
          text: "通知管理",
          permissions: [PermissionChoices.Staff],
          opt: "|",
        },
        children: [
          {
            path: "public",
            name: "public",
            component: public_inform,
            meta: {
              icon: "ChatLineSquare",
              text: "发布通知",
              permissions: [
                PermissionChoices.Boarder,
                PermissionChoices.Leader,
              ],
              opt: "|",
            },
          },
          {
            path: "list",
            name: "list",
            component: list,
            meta: {
              icon: "Comment",
              text: "通知列表",
              permissions: [PermissionChoices.Staff],
              opt: "|",
            },
          },
          {
            path: "detail/:pk",
            name: "detail",
            component: detail,
            meta: {
              hidden: true,
              permissions: [PermissionChoices.Staff],
              opt: "|",
            },
          },
        ],
      },
      //   员工管理模块
      {
        path: "/staff",
        name: "StaffView",
        component: StaffView,
        meta: {
          icon: "Checked",
          text: "员工管理",
          permissions: [PermissionChoices.Boarder, PermissionChoices.Leader],
          opt: "|",
        },
        children: [
          {
            path: "add",
            name: "add",
            component: add,
            meta: {
              icon: "User",
              text: "新增员工",
              permissions: [
                PermissionChoices.Boarder,
                PermissionChoices.Leader,
              ],
              opt: "|",
            },
          },
          {
            path: "list",
            name: "staff",
            component: staff,
            meta: {
              icon: "Avatar",
              text: "员工列表",
              permissions: [
                PermissionChoices.Boarder,
                PermissionChoices.Leader,
              ],
              opt: "|",
            },
          },
        ],
      },
    ],
  },
];

export default routes;
